(function() {

	"use stricts";

	var debug = {};

	debug.log = function(text) {
		var ResultCmpt = CmptManager.get('ResultCmpt');
        if(ResultCmpt == null) {
        	console.log(text);
        	return;
        }
        ResultCmpt.text = text;
	};

	debug.get = function(url, param, title, _call) {
		console.log("\n");
		console.log(title + "请求开始");
		$.get(url, param, (data) => {
			debug.log(data);
			console.log(title + "请求成功");
			console.log("\n");
			
			if(_call != null) {
				_call(data);
			}
		});
	};

	debug.post = function(url, param, title, _call) {
		console.log("\n");
		console.log(title + "请求开始");
		$.post(url, param, (data) => {
			
			if(_call != null) {
				_call(data);
			} else {
				debug.log(data);	
			}
			
			console.log(title + "请求成功");
			console.log("\n");
		});
	};

	debug.post2 = function(url, param, title, _call) {
		console.log("\n");
		console.log(title + "请求开始");
		$.ajax({ 
			url: url, 
			contentType: "text/html",
			data: param,
			dataType: "text",
			type: "POST",
			success: function(data){
				if(_call != null) {
					_call(data);
				}
				console.log(title + "请求成功");
				console.log("\n");
			}
		}); 
	};

	window.Debug = debug;
}());